<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>仿百度注册</title>
    <link rel="stylesheet" href="css/custom.css">
    <style>
    /*=========文本居中=========*/
    .register{
                text-align: left;
                margin:50px;
                padding-top:50px;
                padding-left:60px;
    }
    /*=========提醒的文字样式===========*/
    #demo ,#demo_1{
                    color : #78EFFF;
                    font-size : 10pt;
                }

    </style>
    <script>
    /*=========改变背景的函数=========*/
        function f1(x){
            x.style.background="#F6FF68";
        }
        /*==========响应鼠标事件 =============*/
        function f2(){
                        var str=document.getElementById("yonghuming").value;
                        var x = str.length;
                        if(x>=15||x==0)
                        {
                            document.getElementById("demo").innerHTML = "error";
                            document.getElementById("demo_1").style.color = "red";
                            document.getElementById("a3").src="err_small.png";
                        }
                        else
                        {
                            document.getElementById("demo").innerHTML = "ok";
                            document.getElementById("a3").src="ok_small.png";
                        }
        }
               /*=============响应鼠标事件f3===========*/
               function f3(){
                                var str=document.getElementById("shoujihao").value;
                                var x = str.length;
                                if(x!=15)
                                {
                                 document.getElementById("demo_1").innerHTML = "error";
                                 document.getElementById("demo_1").style.color = "red";
                                 document.getElementById("a2").src="err_small.png";
                                }
                                else
                                {
                                 document.getElementById("demo_1").innerHTML = "ok";
                                 document.getElementById("a2").src="ok_small.png";
                                }

                            }

</script>
</head>
<body>
<center>
<form>
 <fieldset style="width:600px ; height:500px;color:blue;">
<div class="register">
    <p>
        <b> <label>用户名:</label><input type="text"  id="yonghuming" onchange="f2()" onfocus="f1(this)" placeholder="请设置用户名"></b> <span id = "demo">设置后不可更改，中英文均可，最长14个英文或7个汉字</span><label> <img id="a3" style="margin-left: 2px; "src=""></label>
    </p>
    <p>
        <b> <label>手机号:</label><input type="text" id="shoujihao" onchange="f3()" onfocus="f1(this)" placeholder="请填写手机号"></b><span id ="demo_1">手机号不能超过15位数</span><label><img id="a2" style="margin-left: 2px; "src=""></label>
    </p>
    <p>
        <b>  <label>密码:</label><input type="password" placeholder="请设置用户密码"></b>
    </p>
    <p>
        <b> <label onmouseover="style.color='red'"onmouseout="style.color='black'">验证码:</label></b>
        <input type="text" placeholder="验证码" style="width: 95px">
        <input type="button" value="点击获取验证码" style="width: 103px">
    </p>
    <p style="margin-left: 75px;font-size: 12px">
        <input type="checkbox"> 阅读并接受<a href="#">《百度用户协议》</a>及<a href="#">《百度隐私权保护声明》</a>
    </p>
    <p style="margin-left: 75px;">
        <input type="button" value="注册" style="width:80px;">
    </p>
</div>
 </fieldset>
</form>
</center>
</body>
</html>